# Contributor: Celeste <cielesti@protonmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=halloy
pkgver=2024.7
pkgrel=0
pkgdesc="Rust graphical IRC client supporting IRCv3.2 capabilities"
url="https://github.com/squidowl/halloy"
# s390x: nix crate
arch="all !s390x"
license="GPL-3.0-or-later"
makedepends="
	cargo
	cargo-auditable
	openssl-dev
	"
source="https://github.com/squidowl/halloy/archive/$pkgver/halloy-$pkgver.tar.gz"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --frozen --release
}

check() {
	cargo test --frozen
}

package() {
	local appid="org.squidowl.halloy"

	install -Dm755 target/release/halloy -t "$pkgdir"/usr/bin

	install -Dm644 assets/linux/$appid.desktop \
		-t "$pkgdir"/usr/share/applications
	install -Dm644 assets/linux/$appid.appdata.xml \
		-t "$pkgdir"/usr/share/metainfo

	local size; for size in 16 24 32 48 64 96 128 256 512; do
		install -Dm644 \
		assets/linux/icons/hicolor/"$size"x"$size"/apps/$appid.png \
		-t "$pkgdir"/usr/share/icons/hicolor/"$size"x"$size"/apps
	done
}

sha512sums="
a3c178764ca1d9e80dd010eb5f1730a956f55dcde4b7498eb379db3c553666c20e70cccfe0461936a3206864a58000f4c3d6cad46f4818a89172d5ed0097ba0f  halloy-2024.7.tar.gz
"
